package com.bstek.service.impl;

import com.bstek.dao.EmployeeDao;
import com.bstek.model.domain.Dept;
import com.bstek.model.domain.Employee;
import com.bstek.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * @ClassName EmployeeServiceImpl
 * @Description TODO
 * @Author fazi
 * @Date 2019/1/9 20:13
 * @Version 1.0
 **/
@Service
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    EmployeeDao employeeDao;

    @Override
    public Employee get(String username) {
        return employeeDao.get(username);
    }

    @Override
    public List<Employee> list(Map<String, Object> map) {
        return employeeDao.list(map);
    }

    @Override
    public int count(Map<String, Object> map) {
        return employeeDao.count(map);
    }

    @Override
    public int save(Employee employee) {
        return employeeDao.save(employee);
    }

    @Override
    public int update(Employee employee) {
        return employeeDao.update(employee);
    }

    @Override
    public int remove(String username) {
        return employeeDao.remove(username);
    }

    @Override
    public int batchremove(String[] usernames) {
        return employeeDao.batchRemove(usernames);
    }

    @Override
    public boolean exits(Map<String, Object> params) {
        boolean exits = employeeDao.list(params).size() > 0;
        return exits;
    }

    @Override
    public List<Dept> getTree() {
        return null;
    }

    @Override
    public int updateEmployee(Employee employee) {
        return employeeDao.update(employee);
    }

    @Override
    public Map<String, Object> updateEmployeeImg(MultipartFile file, String avatar_data, String username) throws Exception {
        return null;
    }
}
